/**
 * @param {number[]} arr
 * @param {number} k
 * @return {number[]}
 * @description 快排
 */
var getLeastNumbers = function (arr, k) {
    arr = quickSort(arr)
    return arr.splice(0, k)
    function quickSort(array) {
        if (array.length < 2) {
            return array
        }
        let flag = array[array.length - 1]
        // 左边
        let left = array.filter((item, index) => {
            return item <= flag && index !== array.length - 1
        })
        // 右边
        let right = array.filter(item => item > flag)
        return [...quickSort(left), flag, ...quickSort(right)]
    }
};